Repository navigation
docs: add architectural design document for 1.0 - #247
Merged
Merged
Conversation
Add `DESIGN.md` defining the architectural model, public contracts, and target `1.0` boundaries for `logforth-core` and its surrounding crates: - Pipeline topology separating source location, category (`target`), channel (`Logger`), and fan-out (`Dispatch`), plus `Arc<T>` DAG sharing and `ErrorSink` fallback rules. - Core extension traits (`Filter`, `Diagnostic`, `Layout`, `Append`, `ErrorSink`), opaque `Diagnostics` view, and append-only `Layout` byte buffer contract. - Ternary `FilterResult` (`Accept`, `Reject`, `Neutral`) paired with backwards-inducted 24-level `LevelMask` fast-path pruning. - Structured key-value contracts (`ValueView::Str`, causal `ValueView::Error`, lossless ordered `ValueOwned`), operational safety invariants, `rustfmt`- and `Send`-safe native macros, bidirectional `log`/`tracing` interop, and external registry boundary. Signed-off-by: tison <wander4096@gmail.com>
Rewrite `DESIGN.md` as a self-contained target specification rather than a diff against existing `0.x` internals: - Drop special `target` fields and `FilterCriteria` in favor of `Record::module_path`, `Logger::level_enabled`, and single-pass `Filter::check(&Record, Diagnostics)` paired with `Filter::bounds`. - Add the `Diagnostics<'a>` view sketch, retain `#[non_exhaustive]` and existing string variants on `ValueView`, separate normative contracts from examples, and remove parenthetical clutter and chat-specific comparisons. Signed-off-by: tison <wander4096@gmail.com>
State `Record` fields, dynamic filter mask semantics, and `Value`/`ValueView` conversions as complete standalone contracts rather than listing incremental additions or exclusions relative to pre-1.0 code. Signed-off-by: tison <wander4096@gmail.com>
…records Unify pre-construction pruning on `Logger::enabled(level: Level) -> bool` and let `LogBridge::enabled` delegate to it directly instead of keeping a separate `Logger::enabled(&Record)` path or constructing half-populated records. Signed-off-by: tison <wander4096@gmail.com>
Keep `kv` primitives orthogonal and let callers format causal error chains with their own wrapper types rather than baking an opinionated error value variant into `logforth-core`. Signed-off-by: tison <wander4096@gmail.com>
…tion Define `Logger` as a lightweight `Clone` handle over a shared pipeline with static or `Arc<AtomicLevelMask>` per-handle level gates so derived module or subsystem handles share dispatches and `flush` while achieving `O(1)` callsite pruning. Keep `RustLogFilter` strictly `O(1)` on `Record::module_path()` and expose its directive matcher for custom filters rather than adding KV-scanning options. Signed-off-by: tison <wander4096@gmail.com>
Align the private backing enum name of `Diagnostics` with `ValueState`, `MapValueState`, and `ListValueState` in `logforth-core`. Signed-off-by: tison <wander4096@gmail.com>
Document in Ecosystem Interop that inbound `log` and `tracing` adapters populate `Record::module_path` and only emit a `"target"` key-value pair when an upstream event explicitly overrides `target`, removing negative phrasing elsewhere. Signed-off-by: tison <wander4096@gmail.com>
State component sharing and module-level filtering directly instead of referencing nonexistent provider wrappers or key-value scanning options. Signed-off-by: tison <wander4096@gmail.com>
…SIGN.md Drop the speculative `Registry Boundary` section and per-handle `AtomicLevelMask` / `LazyLock<Logger>` machinery from `DESIGN.md`, keeping `Logger` focused on a shared immutable pipeline with `const fn Logger::noop()`. Signed-off-by: tison <wander4096@gmail.com>
…ctures Specify `From<&'a ValueOwned> for Value<'a>` and optional `serde`-backed `ValueOwned` construction so nested custom structures integrate cleanly into `KeyValues<'a>` as concrete value trees. Signed-off-by: tison <wander4096@gmail.com>
…tracts Address final review findings in `DESIGN.md`: - Retain `LevelFilter` items in `Dispatch` filter chains so preceding dynamic `Accept` filters cannot drop downstream level thresholds, while testing each branch's `LevelMask` in `Logger::log`. - Specify `fmt::write` fallback for infallible `Record::to_owned` and `ValueView::to_owned` snapshot conversions, and `from_serde` / `try_from_serde` error behavior. - Mark `ThreadLocalDiagnostic` scope guards `!Send` with shadowed-value restoration, and place the shared bridge reentrancy guard in `logforth-core` across both inbound bridges. Signed-off-by: tison <wander4096@gmail.com>
Specify that `RustLogFilter` exposes named-directive lookup so custom filters can match explicit key-value categories without prematurely triggering the global fallback directive before `module_path` matching. Signed-off-by: tison <wander4096@gmail.com>
Use `check` consistently across `Filter::check` and `RustLogFilter`'s module and named-directive check descriptions. Signed-off-by: tison <wander4096@gmail.com>
Align `Filter::filter` with `Append::append` and `ErrorSink::sink`, keeping `test` reserved for boolean predicates such as `LevelFilter::test` and `LevelMask::test`. Signed-off-by: tison <wander4096@gmail.com>
…nsion - Make `Value<'a>` `Clone` (capable of holding `ValueOwned` alongside borrowed variants) so workspace types can implement `From<&'a T> for Value<'a>` directly, while `Value::debug`, `Value::display`, and `Value::serde` cover explicit conversions without `value-bag` or sigil DSLs. - Standardize native macro key-value entries on explicit `"key" = expr` string literal keys without identifier shorthands or sigils, and specify `Send`-preserving `match` binding across `.await`. Signed-off-by: tison <wander4096@gmail.com>
Require `+ Sync` on `Value::debug` and `Value::display` so `Value<'a>` itself is `Send + Sync` without extra wrapper types, working uniformly inside and outside macros across `.await` points. Signed-off-by: tison <wander4096@gmail.com>
- Keep `Value<'a>` strictly `Copy` as a pure borrowed carrier (including `&'a ValueOwned`), preserving the clean separation between `Value<'a>` (borrowed input), `ValueOwned` (`'static` owned), and `ValueView<'a>` (unified read-only projection). - Replace `permanent contract` with `stable contract` in `Scope and Crate Versioning`, and convert the trailing bullet list in `Core Extension Traits` into prose paragraphs consistent with the rest of the section. Signed-off-by: tison <wander4096@gmail.com>
Streamline parenthetical clauses in `Structured Key-Values and Diagnostics` and `Error Handling and Operational Safety` for consistent declarative prose across the document. Signed-off-by: tison <wander4096@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
DESIGN.mdat the repository root defining the architectural model, public contracts, and target1.0boundaries acrosslogforth-coreand its surrounding crates:logforth-core 1.0vs independent0.xfacade, appenders, layouts, filters, diagnostics, and bridges.module_path), channel (Logger), and fan-out (Dispatch);Loggeras a lightweightClonehandle withconst fn Logger::noop();Arc<T>and&'static Tcomponent sharing;ErrorSinkdispatch-to-logger fallback vsDispatch-scopedFilterandDiagnostic.Filter::bounds+Filter::filter,Diagnostic,Layout,Append,ErrorSink),Diagnostics<'a>zero-copy view, and append-onlyLayout::format(..., buf: &mut Vec<u8>)buffer semantics.FilterResult(Accept,Reject,Neutral), backwards-inductedLevelMask(u32)pruning,Logger::enabled(level), andRustLogFilterfiltering onRecord::module_path().Copy + Send + SyncborrowedValue<'a>, unified#[non_exhaustive]ValueView<'a>, lossless orderedValueOwnedslices (From<&'a ValueOwned> for Value<'a>and optionalserdeconstructors), structured built-in diagnostics with!Sendscope guards,LocalKey::try_withteardown safety, and non-panicking runtime error propagation.["key" = expr]rustfmt-valid and.awaitSend-safe macro expansion, plus bidirectionallogandtracingadapters (handling legacytargetoverrides and loop prevention).